#include "Product.h"
#include <ace/Proactor.h>
#include <ace/Select_Reactor.h>
Product*
Product::instance()
{
	static Product product;
	return(&product);
}

Product::Product()
: reactor_(0)
, gate_acceptor_(0)
{
	reactor_ = ACE_Reactor::instance(new ACE_Reactor(new ACE_Select_Reactor,true) , true); 

	ACE_NEW(gate_acceptor_,GateWayAcceptor());
}

Product::~Product()
{
	delete gate_acceptor_;
}

int
Product::run()
{
	if(-1==gate_acceptor_->open(ACE_INET_Addr("127.0.0.1:60001")))
	{
		ACE_DEBUG((LM_INFO,ACE_TEXT("(-1==gate_acceptor_->open(ACE_INET_Addr(\"127.0.0.1:60001\")\n")));
		ACE_ASSERT(0);
	}

	reactor_->run_event_loop();
	return 0;
}